package org.hazelnuts;

import org.hazelnuts.dao.UserRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * Hello world!
 */
@SpringBootApplication
public class MySqlCommandApplication implements CommandLineRunner {
    private static final Logger log = LoggerFactory.getLogger(MySqlCommandApplication.class);

    @Autowired
    private UserRepository userRepository;

    public static void main(String args[]) {
        SpringApplication.run(MySqlCommandApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        long startTime = System.currentTimeMillis();
        for (int i = 0; i < 100000; i++) {
            userRepository.testSql();
        }
        long stopTime = System.currentTimeMillis();
        System.out.println("程序运行时间： " + (stopTime - startTime) + "(ms)");
    }
}
